-- Modinfo for basic game.

gameDesc = {
  name = "Total Fantasy: Orchestra of War",
  firstPresentation = "menu"
}

-- Initialization.

buttonStyle = {
  normal = { backcolor = { 0, 255, 0 } },
  pressed = { backcolor = { 255, 0, 0 } },
}

function onMenuPres()
  -- init the different menu states' base layers
  local root = ui.root
  local start = ui.newLayer(root)
  local spMenu = ui.newLayer(root)
  local mpMenu = ui.newLayer(root)
  local rpMenu = ui.newLayer(root)
  
  spMenu.visible = false
  mpMenu.visible = false
  
  -- initialize start layer
  local startButtons = ui.newLayer(start, 0.3, 0, 0.7, 1)
  local testButton = ui.newLayer(startButtons, 0, 0.1, 1, 0.2, buttonStyle)
  local mpButton = ui.newLayer(startButtons, 0, 0.2, 1, 0.3, buttonStyle)
  local rpButton = ui.newLayer(startButtons, 0, 0.3, 1, 0.4, buttonStyle)
  local exitButton = ui.newLayer(startButtons, 0, 0.3, 1, 0.4, buttonStyle)
  
  testButton.onClick = function () core.present("world") end
  mpButton.onClick = function () start.visible = false mpMenu.visible = true end
  spButton.onClick = function () start.visible = false spMenu.visible = true end
  rpButton.onClick = function () start.visible = false rpMenu.visible = true end
  exitButton.onClick = function () core.exit() end
  
  testButton.label = "Test"
  mpButton.label = "Multiplayer"
  rpButton.label = "Replays"
  exitButton.label = "Exit"
end

function onWorldPres()
end

core.initGame(gameDesc)
core.addPresentationListener("menu", "onMenuPres")
core.addPresentationListener("world", "onWorldPres")
